<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
    include("recordmanager.php");
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>List Itinerary</title>
        <meta name="keywords" content="itinerary, list" />
        <meta name="description" content="This page provides a list of all itineraries" />
        <link href="css/default.css" rel="stylesheet" type="text/css" />
    </head>

    
    <body>
        <div id="wrapper">
             <?php include 'include/header.php'; ?>
            <!-- end div#header -->
            <div id="page">
                <div id="content">
                    <div id="welcome">
                        <h1>加油记录</h1>
                       
                        <!-- Fetch Rows -->
                               <table class="aatable">
                                   <tr>
                                    <th>加油站</th>
                                    <th>油品</th>
                                    <th>单价</th>
                                    <th>数量（升）</th>
                                    <th>总额</th>
                                    <th>公里数</th>
                                    <th>加油时间</th>
                                    <th>平均油耗</th>
                                </tr>
                                <?php
                                    $recordArray = getRecords();
                                    
                                    for($index=0;$index < count($recordArray);$index++){
                                        $record = $recordArray[$index];
                                        echo "<tr>";
                                        echo "<td>".getStationChineseName($record->get_GasStationName())."</td>";
                                        echo "<td>".$record->get_gasPrice()->get_Name()."</td>";                             
                                        echo "<td>".$record->get_gasPrice()->get_Price()."</td>";
                                        echo "<td>".$record->get_Amount()."</td>";
                                        echo "<td>".$record->get_TotalPrice()."</td>";
                                        echo "<td>".$record->get_Mileage()."</td>";
                                        echo "<td>".$record->get_Time()."</td>";
                                       
                                        $oilWear=getAverageOilWear($record,$recordArray[$index+1]);
                                        $oilWear=round($oilWear,2);
                                        echo "<td>".$oilWear."</td>";
                                        echo "</tr>";
                                    }
                                ?>
                                </table>
                    </div>

                    <div id="note">
                        <p>Click the Flight Name to find more information</p>
                    </div>
                    <!-- end div#welcome -->			
          
                    <h1> 加油站油耗比较 </h1>
                    <script type="text/javascript" src="lib/ofc/js/swfobject.js"></script>
                    <script type="text/javascript">
                    swfobject.embedSWF(
                      "lib/ofc/open-flash-chart.swf", "station_chart", "380", "200",
                      "9.0.0", "expressInstall.swf",
                      {"data-file":"stationoilwear.php"}
                      );
                    </script>
                    <div id="station_chart"></div>

                    <h1> 月度消费</h1>
                    <script type="text/javascript">
                    swfobject.embedSWF(
                    "lib/ofc/open-flash-chart.swf", "month_cost_chart", "380", "200",
                    "9.0.0", "expressInstall.swf",
                    {"data-file":"costbymonth.php"} );
                    </script>
                    <div id="month_cost_chart"></div>

                </div>
                <!-- end div#content -->
                <div id="sidebar">
                    <ul>
                        <?php include 'include/nav.php'; ?>
                        <!-- end navigation -->
                        <?php include 'include/updates.php'; ?>
                        <!-- end updates -->
                    </ul>
                </div>
                <!-- end div#sidebar -->
                <div style="clear: both; height: 1px"></div>
            </div>
            <?php include 'include/footer.php'; ?>
        </div>
        <!-- end div#wrapper -->
    </body>
</html>
